﻿$(document).ajaxStop($.unblockUI);
$(document).ajaxError(function (event, request, settings) {
    alertUser("Error requesting page " + settings.url);
});

function alertUser(text) {
    $("#error").text(text).dialog({
        closeText: '',
        buttons: {
            "Ok": function () {
                $(this).dialog("close");
            }
        }
    });
}

function generateRandomString(length) {
    var source = "abcdefghijklmnopqrstuvwxyz";
    var randomString = [];
    for (var i = 0; i < length; i++) {
        randomString[i] = source.charAt(Math.floor(Math.random() * source.length));
    }
    return randomString.join('');
}